<template>
  <el-scrollbar>
    <div class="content">
      <el-card class="" style="width: 100%; height: 100%; margin-top: 20px">
        <div v-for="(item, index) in this.tenRecommend" :key="index">
          <el-link
            @click="GetArticeFromId(item.id)"
            target="_blank"
            style=""
            >{{ index + 1 }}.{{ item.articleTitle }}</el-link
          >
        </div>
      </el-card>
    </div>
  </el-scrollbar>
</template>

<script>
// import navbar from '../components/Layout.vue'
import { GetArticle } from "../api/articles";
export default {
  data() {
    return {
      tenRecommend: [],
    };
  },
  methods: {
    GetArticeFromId(id) {
      this.$router.push(`/Article?id=${id}`);
    },
  },
  mounted() {
    GetArticle().then(({ data }) => {
      // console.log(data);
      // this.tenRead = data.data;
      // console.log(data.data.data[0].order);
      var res = data.data.data;
      // console.log(res[0].order);
      // console.log(res);
      for (var i = res.length; i > 0; i--) {
        // console.log(res[i-1].order);
        if (res[i - 1].order === 1) {
          this.tenRecommend.push(res[i - 1]);
        }
      }
      // console.log(this.tenRecommend);
    });  },
};
</script>

<style>
/* .el-scollbar > .x{
  min-width:100%;
    display: inline-block;
} */
.el-scrollbar .el-scrollbar__wrap {
  max-height: 836px;
  overflow-x: hidden;
}
</style>